package com.ws.shop.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ws.shop.bean.Page;
import com.ws.shop.dao.AdminUserDao;
import com.ws.shop.entity.AdminUser;
import com.ws.shop.service.AdminUserService;

@Service(value="adminUserService")
public class AdminUserServiceImpl implements AdminUserService {
	@Resource(name="adminUserDao")
	private AdminUserDao adminUserDao;

	@Transactional(rollbackFor=Exception.class)
	public Object[] deleteAdminUserById(int userid) {
		return adminUserDao.deleteAdminUserById(userid);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public AdminUser findAdminUserById(int userid) {
		return adminUserDao.findAdminUserById(userid);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public Page getAdminUserListByPage(int pageno, int pagesize, String username,
			int status) {
		return adminUserDao.getAdminUserListByPage(pageno,pagesize,username,status);
	}

	@Transactional(rollbackFor=Exception.class)
	public void saveOrUpdate(AdminUser adminUser) {
		adminUserDao.saveOrUpdate(adminUser);
	}

	@Transactional(rollbackFor=Exception.class)
	public void updateAdminUserPassword(int userid, String password) {
		adminUserDao.updateAdminUserPassword(userid,password);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public AdminUser findByUsername(String username) {
		return adminUserDao.findByUsername(username);
	}

}
